#!/usr/bin/env python
# -*- coding: UTF-8 -*-

from mongokit import Document
# from api import app
from conf import test as Conf

import datetime

class Player(Document):
	__collection__ =  'player'
	__database__ = Conf.MONGODB_DATABASE
	structure = {
		'uuid': basestring,
		'date_creation': datetime.datetime,
		'login_creation': datetime.datetime,
		'coins': int,
		'userId': basestring,
		'avatar': basestring,
		'postMsg': [{
			'msgId': basestring,
			'date_creation': datetime.datetime,
			'isMaster':bool
		}],
		'fetchMsg':[basestring],
		'netMsg':[{
			'msgId': basestring,
			'date_creation': datetime.datetime,
			'isRead': bool
		}]
	}
	default_values = {'coins': 200, 'avatar': ""}
	validators = {
		'uuid': lambda x: len(x) > 6
		}
	required = ['uuid', 'login_creation']